<template>
  <basic-container>
    <div class="card-border">
      <card-header :header-data="headerData"></card-header>

      <div class="card-body">
        <avue-crud :data="subjectListData"
                   :option="tableoption"
                   :page="page"
                   :table-loading="tableLoading"
                   @on-load="getResultList"
                   @refresh-change="refreshChange"
                   @search-change="searchChange"
                   class="avuecrud">
          <template slot-scope="scope" slot="menu">
            <div class="menu-title" @click.stop="viewEvaluation(scope.row,scope.index)">
              <i class="iconfont iconview icon-primary"></i>
              <p class="menu-title-text">上传评估报告</p>
            </div>
          </template>
        </avue-crud>
      </div>

    </div>
  </basic-container>
</template>

<script>
  import {resultList} from "@/api/planning/result";
  import {PROJECT_DIC} from '@/const/dict'

  export default {
    name: "planningPlait",
    created() {
    },
    data() {
      return {
        headerData: {
          title: '实施评估'
        },
        type: '',
        subjectListData: [],
        page: {
          total: 0, // 总页数
          currentPage: 1, // 当前页数
          pageSize: 10 // 每页显示多少条
        },
        tableoption: {
          page: true,
          menuWidth: 150,
          addBtn: false,
          editBtn: false,
          addRowBtn: false,
          indexLabel: "序号",
          index: true,
          cellBtn: false,
  indexWidth:70,
          delBtn: false,
          columnBtn: false,
          refreshBtn: false,
          filterBtn: false,
          searchBtn: false,
          keyId: "id",
          column: [
            {
              label: "规划名称",
              prop: "title",
              cell: true,
              search: true,
            },
            {
              label: "规划类型",
              width: 100,
              prop: "category",
              type: "select",
              dicData: PROJECT_DIC.CATEGORY,
              cell: true
            },
            {
              label: "申报单位",
              width: 140,
              prop: "orgName",
              cell: true
            },
            {
              label: "年份",
              prop: "year",
              cell: true
            },

          ]
        },
        tableLoading: false,
      }
    },
    created() {

    },
    methods: {
      getResultList(page) {
        this.tableLoading = true;
        resultList(Object.assign({
          current: page.currentPage,
          size: page.pageSize,
          states: '3',
        })).then(response => {
          this.subjectListData = response.data.data.records
          this.page.total = response.data.data.total
          this.tableLoading = false
        })
      },
      searchChange(params) {
        this.page.currentPage = 1
        this.getResultList(this.page, this.dealSearchParam(params))
      },
      refreshChange() {

      },
      dealSearchParam() {
      },
      // 查看评估跳转页面
      viewEvaluation(row, index) {
        let src = `/pim/evaluation/index`;
        this.$router.push({
          path: src,
          query: {achievementId: row.achievementId, title: row.title}
        })
      },
    }
  }
</script>

<style lang="scss" scoped>
</style>
